home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
utility
/
455
/
doc
/
mupfel.doc
< prev
next >
Wrap
Text File
|
1990-07-20
|
42KB
|
914 lines
Last change: 29-dec-1989 for Version 1.1
Mupfel - Yet Another Commandline Shell
Copyright 1989 by Gereon Steffens.
All rights reserved.
English version of docs by Ton van Overbeek, TVOVERBE@ESTEC.BITNET
Starting Mupfel
When Mupfel is started it tries to execute the file MUPFEL.MUP as a batchfile
(see below) in the current directory. If Mupfel is started with at least one
argument then the first one is used instead of MUPFEL.MUP. If the first
argument is "-c" or "-C" then the following arguments are interpreted as
commands and executed and no start batchfile is executed.
The line editor
Mupfel's line editor works together with a so called history.
The size of the history list is selectble (see Internal Variables).
An input line may consist of max 256 characters.
The following keys have a special meaning on input:
ESC:
Clears the whole input line
Return:
Finishes input. The whole visible input line is processed
independent from the cursor position.
Backspace:
Deletes the character to the left of the cursor.
Delete:
Deletes the character under the cursor. At the end of the line
it has the same effect as backspace.
Control-Delete:
Deletes from the current cursor position to the end of line.
Insert:
Toggles between insert/overwrite.
Default is insert mode, which is shown by a static cursor. The
cursor is blinking in overwrite mode.
Left/Right arrow:
Moves the cursor accordingly without changing the input line.
Shift-Left/Right arrow:
Moves the cursor to the beginning/end of line respectively.
Control-Left/Right arrow:
Moves the cursor to the start of the previous/next word.
Help:
Displays the history list.
Up/Down arrow:
Scrolls up/down in the history list.
Shift-Up/Down arrow:
Scrolls up/down in the history list only showing those entries
starting with the characters in the current input line. If the
current line is empty, all entries can be displayed.
Control-X:
Exchanges the character under the cursor with the one to the
right.
Control-C:
Changes upper case letters to lower case and vice versa.
During input you can scroll through the history list without danger. The line
is buffered internally and is shown again when you scroll down to the latest
entry. If you clear the history line shown during scrolling (with backspace,
DEL or ESC) then the internal pointer for the next line to be shown is reset
to the latest entry.
You can input all character codes between 1 and 255 with the Mupfel line editor.
For characters which are not available on the keyboard you can type the
corresponding numeric code on the numeric keypad while pressing the Alternate
key. As soon as you release the Alternate key the corresponding character is
generated.
Command line parsing
Mupfel splits every input line in tokens. Every character string which is
bounded by space, tab, beginning or end of line is a token. To include spaces
or tabs in a token you need to surround it with a single or double quote
(' or "). These characters are not part of the token. Tokens that contain one
of the characters '*' or '?' or a string between '[' and ']' are so called
wildcards (see below). These wildcards are - if possible- expanded, where
each result generates a new token. In case that no filename matches a wildcard
the original token is left unchanged. The wildcard expansion can be suppressed
by quoting (with ' or "). A token starting with $ is a reference to the
environment. The longest following string of alphanumeric characters is
interpreted as the name of an environment variable. If this variable does
not exist the token is deleted. You can enclose the variable name after the
$ in curly braces ({ and }) to avoid conflicts. ${HOME}1 represents the
contents of the variable HOME followed by a 1. Alternatively you can use
"$HOME"1. Environment references in quoted tokens are only resolved when
using ". When using ' all characters are taken unchanged. Tokens starting with
>, >> or < are interpreted as starting I/O redirection (see below). If the
startup code in a program does the I/O redirection you can quote these tokens.
If a non quoted token starts with ~ then it is replaced with the current
directory. In this way you can pass files in the current directory to GEM
programs which are somewhere else without a lot of typing.
Mupfel allows to put several commands on one line separated by semicolons.
If you need to include semicolons in a token then you have to quote it
(important for $PATH, $CDPATH and $SUFFIX).
Alias expansion
When during the division of the command line into tokens the first token is
complete the alias list (see Alias) is searched for an alias for this name.
If a match is found then the first token is removed, the remaining part of the
input line is appended to the replacement text and the parser is started again.
To avoid infinite recursive aliases and to facilitate easy shorthand for some
commands this alias expansion is only done once.
Examples:
alias cp 'cp -v' # Be talkative during copy
alias locate whereis # Just another name...
alias b a
alias a b # Input of a starts command b. No loop!
alias l 'ls -cdf' # Very usefull
alias use 'pwd;du .' # You can use more than one command.
Wildcards
Mupfel supports a Unix-like wildcard notation, derived from the so called
"regular expressions". The following wildcard characters are possible:
* - Matches zero or more characters.
? - Matches exactly one character.
[...] - Matches the characters between [ and ].
[x-y] - Matches all characters from x to y.
[^...] - Matches the characters *not* between [ and ]
(x-y works too).
These components can be combined in any sequence. For example "[a-f]??[0-9*x"
matches every filename starting with a letter between a and f followed by any 2
characters then a digit and with an x as last character.
NOTE: The wildcard "*" matches _ALL_ filenames, not (as in TOS) only those
without extension!
NOTE #2: During wildcard expansion files with the hidden attribute (see chmod
and ls) are _NOT_ considered!
The environment
Mupfel makes a very extensive use of the otherwise not so much used environment
on the ST. The following variables are used:
SHELL: The complete path to Mupfel itself. At start composed
from the current directory and the function shel_read().
PATH: Search path for external commands. Single components are
separated by semicolon or comma.
COLUMNS: The number of characters per line. At start computed
with the VDI function vq_chcells(). The ls and help
commands use this value.
ROWS: The number of lines on the screen. Used by the internal
more command.
HOME: The default directory for cd.
PS1: Primary prompt. Used by the command line editor for the
output of a promptstring. May contain the following
special sequences:
%P Current drive and directory in upper
case
%p As %P, but in lower case
%D Current date
%T Current time
%N CR/LF
%% the % character
%i reverse video on
%I reverse video off
xARG: Used for passing arguments with the xARG method.
See "The xARG method".
IMV: Contains the addresses of some internal Mupfel
variables. Used for the inheritance of aliases, function
keys, the hashtable and some other internal variables
(only interesting for a second Mupfel).
(Note: the IMV and xARG variables are normally not visible,
because they are generated immediately before the start of an
external program and deleted directly afterwards)
ARGV: This variable is reserved for the EXARG method (See
below) and should not be used.
CDPATH: Directory searchpath for cd. Single components are
separated by semicolon or comma.
SUFFIX: Contains (a semicolon or comma separated) list of
extensions to be eused for executable programs. The
individual components may be max 3 characters long.
NOTE: Only the contents of $SUFFIX determine if a
program is executable. This is important for systems
which work with load-time linking. You have to take
into account that $SUFFIX is searched from left to
right. This means that short extensions must be put
before those which contain this extension, i.e.
"TOS;O" does not work, but "O;TOS" does.
<programname_extension>:
With this variable you can tell Mupfel if at the start
of a program the mouse or text cursor should be on or
off and if a grey background should be drawn. The name
of this variable corresponds to the program name and
extension in upper case with the dot replaced by an
underscore '_', for example $TC_PRG or $GOME_TTP.
The value may consist of max eight fields separated by
semicolon or comma. Each field has the format
[MCBSDWXK]:[YN].
M: Mouse on?
C: Text cursor on?
B: Grey background?
S: Pass arguments also with shell_write()?
D: Change the current directory to the
directory of the program?
W: (Only for GEMINI!) TOS program output in
the console window?
X: Use the EXARG method? (see below)
K: Wait for a key after end of program?
With "Y" after the colon the function is activated,
with "N" not.
If such a variable does not exit, or a field is not
given the following defaults are used:
- GEM progs (PRG,APP): M:Y,C:N,B:Y,S:Y,D:Y,W:N,X:Y,K:N
- TOS progs (TOS,TTP): M:N,C:Y,B:N,S:N,D:N,W:Y,X:Y,K:N
In the following this variable is mentioned as
$PRGNAME_EXT.
TOSDEFAULT and GEMDEFAULT:
With these two variables you can set the default start
parameters for TOS and GEM programs. The format is the
same as described under $PRGNAME_EXT.
DRIVEMAP: Contains the list of drive names (only the letters) for
which the commands "df -a", "pwd -a" and "find -a"
should give information.
CONSOLEDIR: (Only for GEMINI) Here you can indicate in which
directory you want to be the first time the console
window is opened.
The names of the environment variables may consist of letters, digits and the
characters '_', '?' and '#'. The character '=' may not occur in the value of an
environment variable.
The commands "setenv", "env" and "show" are for managing the environment.
Internal variables
Mupfel has besides the environment also some internal variables. These
variables are used to control internal functions and to pass arguments to
batchfiles. These variables can be referenced in the same way as the environ-
ment variables with a leading $ character. The following variables are defined:
a) Not changeable by the user:
0,1,...,9 The first 10 arguments for a batchfile. ($0 contains
the name of the batchfile).
# The number of arguments for a batchfile.
? The returncode of the last executed command.
cwd In this variable you will find the name of the current
working directory.
shellcount A counter counting the number of times Mupfel is in
memory.
drivelist A list of all the physically connected floppy and hard
disk drives.
b) Changeable by the user:
screensave If this variable is defined then the current text
screen is saved before the execution of a GEM program
and afterwards restored. For this at least 32 Kbyte
memory is dynamically allocated. The exact size is
determined by the number of pixels and planes of the
screen (from v_opnvwk() and vq_extnd()). The complete
screen is copied with vro_cpyfm().
noclobber If this variable is defined then an already existing
file is not overwritten by "normal" I/O redirection.
history This variable can be used in the autoexec file (only
there!) to set the size of the history list. The
default value is 20.
keepfree With this value you can tell how much memory the
commands cp and mv should *NOT* use (important when
using for example Alex Esser's FlexDisk). If not
defined the value 8192 is used.
errorfile When this variable is defined it is interpreted as the
name of a file or device (e.g. CON:) to which GEMDOS
handle 2 should be redirected for each program/command
in case no explicit redirection is specified.
If the filename starts with ">" then the file is
appended (same as 2>>xxx), otherwise the file is
created each time (as in 2>xxx). This is usefull for
programs which use handle 2 for error output (e.g GNU
programs and MWC). With "set errorfile con:" in the
autoexec file the errormessages of these programs are
shown on the screen.
These variable names are fixed internally. There cannot exist variables with
the same names in the environment.
I/O redirection
Mupfel does I/O redirection itself. By ">file" you can redirect the standard
output of internal and external commands to file. If file already exists, it is
created again. With ">>file" the output is appended to the end of file. With
"<file" you can redirect the standard input to file. The file has to exist.
To create files in spite of "noclobber" you can use ">!" or ">>!" instead of
">" and ">>" for output redirection.
For the redirection of handle 2 (the serial channel, used in some programs for
error output) you can use "2>", "2>>" etc. in the same way. See also "errorfile"
under "Internal variables".
If you specify input or output redirection for a batchfile then Mupfel repeats
this automatically for each command in the batchfile. You can still specify
the redirection to different files for each single command in the batchfile.
The I/O redirection works only for programs which use GEMDOS handles 0, 1 and 2
for input and output. Warning: In the old ROM TOS there are a few errors which
make it impossible to use this function! (TOS version before 1.4, GEMDOS version
before 00.21)
NOTE: The use of software blitters (TurboST or QuickST) makes the redirection
of program output impossible!!
Command execution
The first token of each commandline is interpreted as the name of a command to
be executed. If this token does not contain any path components or extensions
(e.g. starts with . or \ or ends with .xxx) then first the list of internal
commands is searched. In case it is not an internal command every component of
$PATH is searched for a program with this name. To do this the extensions
specified in $SUFFIX are appended in order. Files ending in .MUP are batchfiles.
These files are not executed directly, but are text files containing Mupfel
commands. Batchfiles can be nested to any depth. In case there are naming
conflicts between internal and external commands you can change the just
described search order by using upper case for the first token of a command
line.
If the command is an external command and the commandtail, after token
expansion, is longer than 124 characters then the arguments are only passed
with the xARG method (see below).
Internal commands can only be started with expanded wildcards, because there
may be unwanted effects or even (because of GEMDOS errors) system crashes.
An exception to this rule are the commands "alias", "echo", "tree", "fkey" and
"setenv".
Internal commands and external TOS or TTP programs can be terminated by
Control-C when they produce output.
External commands inherit the environment. Via the variable $IMV information
is passed about the aliases, the functionkeys, hashtable and some internal
variables. This is usefull for a later started second (or third or ...) Mupfel,
because otherwise this information would not be available.
GEM programs
GEM programs are recognized by the extensions .PRG or .APP.
Before their execution the current directory is normally changed to the one
of the program (so resource and other files can be loaded). This function can
be suppressed with the field "D:N" in $PRGNAME_EXT.
Moreover, when not otherwise specified in $PRGNAME_EXT (see above), the text
cursor is switched off, the mouse on, the normal desktop background is
generated and the arguments are passed with shell_write().
Some GEM programs inform the AES with the function shell_write() that another
program is to be started after they end, for example GEM-DRAW which starts
OUTPUT.APP. This starting is done by the AES after the Pterm() call of the
current application. Because programs started with Pexec() are not recognized
by the desktop as separate applications, this function is handled by Mupfel.
A small problem is that you cannot tell the AES after a shell_write() call
that there is no program to start. Mupfel uses a trick to solve this: before
the end of Mupfel the AES is told to start the program $HOME\EXIT.PRG. EXIT.PRG
could be generated form the following C source: "main() {return 0;}".
In case $HOME\EXIT.PRG does not exist then "$SHELL -q" is specified as the
program to start. "Mupfel -q" executes Pterm(0) immediately.
Command hashing
Mupfel uses a so called hashtable for external commands. Commands which must
be located in $PATH are entered in this table, so the search does not have
to be repeated when the same command is used later. If a program, already in
the hashtable, is moved to another directory, deleted or renamed then the old
entry is deleted. The next time the command is used $PATH is searched and a
new entry in the hashtable is created.
If the environment variables PATH or SUFFIX are changed or deleted the hashtable
is deleted.
The xARG method
The xARG method (proposed by Allan Pratt and Dale Schumacher) allows the passing
of command lines longer than 124 characters to programs. For this purpose the
calling program creates an xARG structure which looks as follows:
typedef struct
{
char xarg_magic[4]; /* contains "xARG" */
int xargc; /* as argc in main() */
char **xargv; /* as argv in main() */
char *xiovector; /* not used */
PD *xparent; /* pointer to callers basepage */
} XARG;
In the environment variable xARG the address of this structure is passed to the
called program as an eight digit hexadecimal numer. The called program has to
check by using xarg_magic if it really is a XARG structure and test by
comparing the pointer to the parent in its own basepage with xparent if the
information comes from its own parent. You can find an example program for the
use of the xARG method in the file XARG.C.
The EXARG method
The EXARG method (since some time standardized by Atari USA) allows, as does
the xARG method, the passing of command lines to programs longer than 124
characters. EXARG is an extension of the method introduced by Marc Williams
where the command line is passed in the environment. The problems with the
Marc Williams method are solved in the EXARG method. In EXARG the variable ARGV
is appended to the end of the environment followed by (separated by '\0') the
individual arguments. To indicate that EXARG is used the length byte of the
command line is given the (normally) illegal value 127 at the Pexec() call.
The child process can now extract the arguments from the environment and has
to (!) remove the ARGV variable from the environment (this is done by over-
writing the 'A' with a '\0'). An example for the use of the EXARG method can
be found in the official Atari description in the file EXARG.TXT.
This method (how wonderfull that Atari has specified a standard) also has a
disadvantage: programs that use the Marc Williams method do not understand this
method of passing arguments. To partially circumvent these problems EXARG is
only used if there is at least one argument to pass. If arguments have to be
passed to these programs you can use the field "X:N" in $PRGNAME_EXT.
The system() call
Processes started by Mupfel can "delegate" tasks to Mupfel. This is possible
by using the system variable _shell_p (address 0x4F6). At this address Mupfel
installs a pointer to an internal routine. This routine expects on the stack
a pointer to a command line to be executed. The result of the execution is
returned in the register D0.W. A sample program for calling Mupfel via
_shell_p is in the file SYSTEM.C. Mupfel uses the XBRA method to redirect the
_shell_p vector. The XBRA-id used by MUPFEL is "MUPF". When called via _shell_p
Mupfel first saves the registers D1-D7 and A0-A7. Then a block of 8K memory is
allocated which serves as stack for work in Mupfel. After the command is
finished this memory is freed again and all registers are restored.
A problem is that _shell_p is not initialized at warm boot. Programs using
system() will find a legal XBRA header after warm boot and will almost
certainly crash. A solution for this problem is the program SHELL0.PRG that
has to be copied to the AUTO folder. SHELL0.PRG and the source code (SHELL0.C
for Turbo-C) are included.
Internal commands
The names and functioning of the internal Mupfel commands are strongly
influenced by UNIX(tm) and the Bourne shell. In the following description
optional entries are in [] and repeatable entries are indicated by ....
exit [arg]
Terminated Mupfel. If arg is specified and it represents a
numerical value then it is given as return code to the calling
program, otherwise 0. When used in batchfiles it terminates
only execution of the batchfile and returns to the calling
batchfile or Mupfel.
In GEMINI this command only leaves the console window.
cd [dir]
Changes to directory dir. Without arguments the value of $HOME
is taken. Dir may have a leading drive indication (e.g. C:\BIN).
If CDPATH exists in the environment and a change to dir is not
possible then dir is appended to each component of CDPATH in
turn and a change is tried to the resulting directory.
pwd [-a]
Pwd (print working directory) without argument shows the current
directory on the current drive. With the -a (all) option the
current directories of all drives. The availability of a drive
is determined in the same way as in "df" (see below).
x:
Changes the current drive to drive x. If the drive letter is
given in lower case the directory is changed to the current
directory of this drive. With an upper case drive letter the
change is made to the drives root directory.
pushd [dir]
Stores the indicated directory on a stack. The current direc-
tory is stored when no argument is given. Relative paths (not
starting with \ or a drive name) are first expanded to absolute
paths.
podp
Retrieves the last stored directory from the stack and does a
"cd" to it.
dirs
Shows the contents of the directory stack in LIFO order, i.e.
the first line of output shows the last pushed directory.
help [cmd...]
Help alone shows a list with all internal commands. This list
is output with max $COLUMNS characters in several columns.
With arguments short help texts for these commands are shown.
cp [-icdvabs] file1 file2
cp [-icdvabs] file... dir
cp -r [-a] dir1 dir2
Cp copies files. In the first format file1 is copied to file2.
If file2 alraedy exists it is created again. In the second
format all files are copied into directory dir. When the option
-c (confirm) is specified then if a target file already exists
Mupfel asks if it may be overwritten. Possible responses to the
question are 'y' (copy), 'n' (do not copy and continue), 'q'
(quit cp command) and 'a' (do not ask anything from now on).
With the option -i (interactive) Mupfel asks for each file if it
should be copied or not. Possible answers are the same as for
"cp -c".
With the option -d (date) the target file modification date is
the same as the one of the source file. Otherwise the current
system date and time are used.
With the option -r (recursive) the complete directory tree under
dir1 is copied to dir2. If dir2 does not exist it is created.
With the -v (verbose) option each filename is shown.
Cp copies also the file attributes (see chmod) if the '-a' (ar-
chive) option is not specified. If '-a' is specified then only
the files with a set archive bit are copied. After a success-
full copy the archive bit of the source file is cleared (see
also chmod).
With the -b (brute force) option it is possible to overwrite
write protected files.
With the -s (secure) option the copy is not made (as otherwise)
directly to the target file, but first to an intermediate file.
Only when this succeeds the target file is deleted and the
intermediate file is renamed. The intermediate file has the
same name as the target file, only the extension is replaced
with $$$. If a file with this name already exists it is quietly
overwritten.
mv [-icvb] file1 file2
mv [-icvb] files... dir
mv [-icv] dir1 dir2
Mv renames files. This works within one logical drive with the
GEMDOS function Frename(). In case of different drives for
source and target first a copy is done (with cp) and then the
source file is deleted.
The first format renames file1 to file2. If file2 already
exists it is created again.
The second format moves all files into the directory dir.
The third format renames the directory dir1. This only works
for TOS versions from 1.4 onward.
The -c, -i and -v options work in the same way as for cp.
Mv never changes the modification date of a file.
Within a logical drive you cannot rename write protected files
unless the -b (brute force) option is used. With -b mv can
both rename write protected files and give a name to a file
which is already used by another write protected file.
rename [-icv] ext files...
Rename renames all indicated files by changing their extensions
to ext. Files with no extension will get the extension ext.
Exit may start with a dot but may not be followed by more than
1 to 3 characters.
The options -i, -c and -v work the same as for cp.
rm [-rivfb] files...
Rm deletes files. With the -i (interactive) option Mupfel will
ask for each file if it should be deleted. Possible answers are
'y' (delete file), 'n' (don't delete and continue with the next
one) or 'q' (quit rm command).
The option -r (recursive) deletes whole directory trees.
The option -v is the same as in cp and mv.
With the -f (failure) option no error message is given when one
of the files to be deleted does not exist and the return code
is always 0.
Rm cannot delete write protected files when the -b (brute force)
option is not specified.
mkdir dir...
rmdir dir...
Deletes directories (rmdir) or creates them (mkdir). Rmdir can
only delete directories without files or subdirectories. Mkdir
can only create a directory when no other file with the same
name exists.
chmod [+-] [aswh] files...
Chmod changes file attributes. With + or - you can set, respec-
tively clear, attributes. The attribute codes mean:
a - The archive bit. Used by backup programs and
"cp -a".
s - The system bit. Hides a file on the desktop.
h - The hidden bit. Hides a file on the desktop.
w - The write-enable bit. Changes the write protection
of a file.
touch [-c] [-d hhmm|ddmmhhmm[yy]] files...
Touch sets the modification date of all files to the current
date. If a file does not exist it is created. The -c (create)
option suppresses this creation.
With the -d option you can specify what modification date to
set. The format for the date corresponds to the one for the
"date" command.
ls [-srtldcufh] [files...]
Ls shows the contents of directories. Normally the files are
shown sorted in one column under eachother. If an argument is
a directory then all the files in this directory are shown.
This normal functioning of ls can be influenced with the
following options:
-l (long): Except for the name also the attributes,
size, modification date and time are
given.
-d (directory): Directories are shown as such.
-c (columns): The output is in columns with max
$COLUMNS characters per line.
-u (unsorted): The output is not sorted but is in the
order in which the files are in the
directory on the floppy/disk.
-s (size): The files are not sorted by name but by
size, the largest one first.
-t (time): The files are sorted by modification
date, newest file first.
-r (reverse): The sorting is reversed.
-f (filetype): For directories a "\" is appended to the
name, for executable programs (files
whose extension is in $SUFFIX) a "*".
-h (hidden): Files with the hidden attribute (see
chmod) are normally not shown. They
are included with -h.
The option -u overrides -s, -t and -r.
The option -l overrides -c.
lu
Same as "ls -u"
lc
Same as "ls -c"
ll
Same as "ls -l"
echo [args...]
Echo echoes its arguments. In the arguments the following
special sequences are allowed:
%% echoes as %
%t echoes as TAB
%n echoes as CR/LF
%c (only at the end of the last argument) sup-
presses the following CR/LF.
%0 lead-in sequence for an arbitrary character
represented by max 3 octal digits.
"echo %033E" for example clears the screen.
cat files...
Cat outputs the contents of the indicated files. Cat without
arguments reads from the keyboard untill the character
Control-D (ASCII End-Of-Text) is input or the Undo key is
pressed.
more files...
More outputs the contents of the indicated files. It shows
always one screen full (determined by $ROWS) and waits for
input. The allowed inputs and their function are (^X means
Control-X, upper and lower case have the same effect):
SPACE,F,^F,Shift-down arrow Next page
RETURN,J,+,down arrow Next line
^B,B,Shift-up arrow Previous page
K,-,up arrow One line back
0,Clr/Home To start of file
$,G,Shift-Cr/Home To end of file
ESC,UNDO,Q,^C Quit more
N To next file
P To previous file
HELP,H Show help
/,? Search (/=forward,
?=backward)
A Repeat last search
^G Show info
With the / and ? commands more expects the search string to be
input on the bottom line. An empty line repeats the last search
(same as A). The search is always exact, i.e. upper and lower
case are not the same. More tries always to show the found line
as high as possible on the screen. If the search reaches the
beginning or end of file the search direction for the next A
command is automatically reversed.
ADVICE: You should not redirect the output of more since it
contains escape sequences to control the screen.
print [-f|-l lin] files...
Print sends the indicated files to the printer.
With the -f (formfeed) option a formfeed is appended to each
file.
With the -l (lines) option a formfeed is sent after every lin
number of lines.
whereis cmd
Searches cmd in the alias list, the internal command list, the
hashtable and in $PATH.
Lower case arguments are first searched internally and then
in $PATH, upper case arguments the other way around.
df [-a|drv:]
Without arguments shows the free space on the current drive.
With the -a (all) option this is done for all connected drives
or for those specified in the environment variable DRIVEMAP.
If DRIVEMAP is not defined then the function Drvmap() is used
to determine which drives are connected. Because this will
always include drives A: and B: the system variable _nflops
(address 0x4A6) is checked to find out how many floppy drives
are really connected.
If a drive name is given (e.g. C:) then only the free space for
this drive is given.
label [drv [volnam]]
Label alone shows the volume label of the current drive. If drv
is given the volume label for this drive is shown. With three
arguments the volume label of the indicated drv is changed to
volnam. Volnam may not be equal to a file or directory name
in the root directory of this drive. If volnam consists of a
single minus character the volume label of the indicated drive
is deleted.
Note: Some versions of TOS 1.4 do not support the creation of
volume labels, in others (e.g the one from 6.4.89) it is not
possible to delete a volume label (you can only replace the
label by an other one).
backup [-icv] files...
Copies all indicated files changing their extension to .BAK.
The options -i, -c and -v work the same as for cp.#
tree [-di] [-f filespec] [-p path]
Shows directory trees starting from path or from the current
directory. If "-f filespec" is given (filespec may contain
a wildcard expression (see above)) then only files matching
the filespec expression are shown. The default for filespec
is "*".
Note: You have to use quoting when filespec contains wildcards.
With the -d (directory) option only directories are shown.
With -i (indent) the position of the file in the tree is shown
by indentation.
If the start directory is the only option then the "-p" may be
omitted, e.g. "tree -p xxx" is equivalent to "tree xxx".
find directory patterns...
Find searches from the indicated directory for all files with
names that match one of the given patterns. A pattern may
contain a normal wildcard expression (see above). When, instead
of directory, "-a" is specified find searches all drives given
in $DRIVEMAP. If $DRIVEMAP does not exist then all connected
drives are searched.
hash [-r]
Without an argument the hashtable for external commands is
displayed. The entries mean:
Hits: Number of times this program is called.
Cost: Initial effort to find the program.
Cmd: Command name.
Full Path: Complete path of the called program.
The -r (remove) options clears the hashtable. The hashtable
is cleared automatically when the environment variables $PATH
or $SUFFIX are changed.
setenv [var [val]]
Without arguments all environment variables are shown.
With only one argument var is deleted from the environment.
With two arguments var is entered into the enviroment with
contents val or the previous contents of var is changed to val.
Upper and lower case are not identical!
Note: var does not need a leading '$' character and a '='
sign is not needed between var and val!
show [var]
env [var]
Without arguments all environment variables are shown.
Otherwise the contents of environment variable var is shown
in the form var=value. You can also display internal variables
with "env var" or "show var".
set [var [val]]
Without arguments the current values of the internal variables
are shown.
The contents of var are deleted with 'set var'.
The value of var is changed to val with 'set var val'.
var=val
Changes the contents of the internal or environment variable
var to val.
var=
Deletes the internal or environment variable var.
alias [name [replacement]]
Alias manages the internal alias list. Without arguments the
current alias list is shown. With one argument the alias for
name is deleted. With two arguments the alias of name is set
to replacement.
If replacement contains more than one token then you need to
quote the replacement text with single or double quotes.
The alias list is always sorted alphabetically.
noalias cmnd
The purpose of noalias is to execute cmnd without alias
expansion. This may be usefull if you normally use an alias
like "alias cp 'cp -i'" but you'd like to use the 'normal' cp
in a batchfile. In such a case you can use "noalias cp ..."
in the batchfile.
fkey [key [text]]
Without arguments the current keybindings for the function keys
F1 to F10 and Shift-F1 to Shift-F10 are shown. The argument
key may be a number between 1 and 20 or the name of a function
key (F1, F2, ... F10, SF1, SF2, ... SF10). With only the key
argument the binding for function key key is deleted. With
two argument the function key binding is set to text. If the
last character of text is a "|" then it is replaced by CR when
the function key is pressed.
date [hhmm|ddmmhhmm[yy]]
Shows the current date and time without arguments.
With an argument the internal hardware clock and the GEMDOS
clock are set. The following three formats are possible:
hhmm hour/minute
mmddhhmm month/day/hour/minute
mmddhhmmyy month/day/hour/minute/year
If not all values are given the corresponding values from
the ST current date and time are taken.
wc [-lcw] files...
Wc (word count) counts lines, words and characters in files.
If one or more options are given only the corresponding values
are shown. The options mean:
-l count lines
-w count words
-c count characters
If several files are given then a line with the corresponding
totals is shown.
du [directories]
Du (disk usage) determines the size of the given directories
(or of "." when no argument is given). The total size of all
files below the start directory, the number of files and the
number of directories below the start directory are shown.
file files...
File tries to determine the type of files by examining the
first 512 bytes of each file.
init [-y][-s 1|2] drv
Init overwrites the first two tracks of a diskette in drive A
or B with zero sectors. This clears the root directory and the
FAT. Then a new boot sector with a random serial number is
generated. The -s (sides) option is used to tell if the
diskette is single (1) or double (2) sided. After "init" the
diskette always has 9 sectors per track!
Normally init asks for confirmation is you really want to
initialize the diskette. With the -y option this question is
already answered with yes.
timer [-s]
The timer command with the -s options sets an internal timer
to the current value of the system variable _hz_200 (0x4ba).
Without this option the difference between this timer and the
current value of _hz_200 converted to seconds is shown. At the
start of Mupfel this timer is initialized automatically. If you
have not used 'timer -s' the timer command measures the
running time of Mupfel.
setscrap [-fq] [dir]
With setscrap you can display or set the AES scrap path. The
current scrap path is displayed without arguments. With a
directory name the scrap path is set to the indicated directory.
The name must be an absolute path, i.e. it has to start with a
drive (for example "C:\CLIPBRD", DR recommends to use the
directory CLIPBRD on the boot drive as the scrap path) and it
has to be an existing directory. Normally setscrap only allows
the setting of the scrap path if no one has been defined.
This may be overridden with the -f (force) option. The -q
(quiet) option suppresses error messages. A recommended way
of using setscrap in the autoexec file MUPFEL.MUP is the
following:
setenv SCRAPDIR c:\clipbrd
setscrap -q $SCRAPDIR
blitmode [on|off]
Blitmode without options shows the status of the blitter chip
(not installed, on or off). With an option you can switch the
blitter on or off (if installed of course).
version [-amgdt]
Version shows the relevant version numbers of the system soft-
ware and of Mupfel. Without options the Mupfel's version
number is shown. The options mean:
-m: display Mupfel version
-g: display GEM version
-d: display GEMDOS version
-t: display TOS version, manufacturing date and
country code
-h: display the version of a AHDI 3.01 compatible
hard disk driver, if one is installed
-a: display all versions
shrink [-b val][-t val][-f][-i]
The purpose of shrink is to reduce the available memory. This
command is intended for programmers with 'large' computers
who want to test if their programs work on 'small' machines.
The -b (shrink by) and -t (shrink to) options reduce the
available memory. '-b' reduces the current available memory by
the value val. '-t' reduces the memory such that still 'val'
bytes are available. Val may be given in octal (recognized
by a leading zero), decimal or hexadecimal (recognized by a
leadin 0x or 0X). You can use the suffix k or m for easy input
of kilo- or megabyte values respectively. The following
values are identical:
20480 050000 20k 0x14k
The -i (info) option shows how much the memory currently is
reduced and how much memory is still available. Shrink without
arguments does the same. The -f (free) option makes all
memory available again.
You have to add the results of several consecutive shrink -b or
shrink -t.
INFO: shrink reserves memory with the GEMDOS function Malloc().
This does not allow to determine the TPA size of child
processes exactly, but it is sufficient for testing purposes.
pause [args]
The pause command (usefull in batch files) waits for a key
press. If there are arguments then these are output as with
echo (see above) (a trailing CR/LF is never output), otherwise
the text "Press RETURN..." is output. Then pause waits for an
(almost) arbitrary key press (Shift, Ctrl, Alt, CapsLock, the
mouse and joystick keys as well as the reset button do not have
the wanted effect :-)
cookie
The cookie command shows the contents of the cookie jar, in
case it is installed. The cookie jar is a collection of flags
supported from TOS 1.6 (the STe TOS).
--------------------------------------------------------------------
UNIX is a trademark of you-know-who